package com.ruantu.clothing.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author meng
 */
public class Time {
    public static String stampToDate(long lt) {
        String res;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        Date date = new Date(lt);
        res = simpleDateFormat.format(date);
        return res;
    }

    public static String toyyyyMMdd(Date date) {
        if (date == null) {
            throw new RuntimeException("格式化的日期不能为空");
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        return sdf.format(date);
    }

}
